//
//  NewPersonalNetWork.m
//  Shengzhuli
//
//  Created by FXGuo on 2018/1/27.
//  Copyright © 2018年 kamangkeji. All rights reserved.
//

#import "NewPersonalNetWork.h"
#import "GFXNetworkHandle.h"
#import "MemberModel.h"
#import "CommendModel.h"
#import "TicketRecordModel.h"

NSString * const MemberList = @"joinMember/regularList";//角色列表
NSString * const PersonConnection = @"personConnectionList";//人物推荐
NSString * const PersonLike = @"auth/personLike";//人物推荐
NSString * const TicketRecord = @"auth/ticket/record";//券使用记录

@implementation NewPersonalNetWork

+ (void)getMemberListWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg,NSArray *lists))response
{
    [[GFXNetworkHandle shareHandle]post:MemberList params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            NSMutableArray *sources = [NSMutableArray array];
            for (NSDictionary *dict in json[@"result"]) {
                MemberModel *model = [MemberModel objectWithDict:dict];
                [sources addObject:model];
            }
            response(YES,json[@"message"],sources);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];
}
+ (void)getPersonConnectionListWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg,NSArray *lists))response
{
    [[GFXNetworkHandle shareHandle]post:PersonConnection params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            NSMutableArray *sources = [NSMutableArray array];
            for (NSDictionary *dict in json[@"result"]) {
                CommendModel *model = [CommendModel objectWithDict:dict];
                [sources addObject:model];
            }
            response(YES,json[@"message"],sources);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];
}

+ (void)zanClickParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg))response
{
    [[GFXNetworkHandle shareHandle]post:PersonLike params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            response(YES,json[@"message"]);
        }else{
            response(NO,json[@"message"]);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError);
    }];
}

+ (void)getTicketRecordParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg,NSArray *lists))response
{
    [[GFXNetworkHandle shareHandle]post:TicketRecord params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            NSMutableArray *sources = [NSMutableArray array];
            for (NSDictionary *dict in json[@"result"]) {
                TicketRecordModel *model = [TicketRecordModel objectWithDict:dict];
                [sources addObject:model];
            }
            response(YES,json[@"message"],sources);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];
}


@end
